package top;

import kaiin.KaiinBeans;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class Top extends HttpServlet{

	public void doGet(HttpServletRequest req, HttpServletResponse res)
	throws IOException, ServletException{
		this.doPost(req, res);
	}

	public void doPost(HttpServletRequest req, HttpServletResponse res)
	throws IOException, ServletException{

		HttpSession session = req.getSession(false);

		if(session == null){
			session = req.getSession(true);
		}

		if(session.getAttribute("kbean") == null){
			KaiinBeans kbean = new KaiinBeans();
			session.setAttribute("kbean", kbean);
		}


		//res.setContentType("utf-8");
		req.setCharacterEncoding("utf-8");

		RequestDispatcher dp = req.getRequestDispatcher("./src/jsp/top.jsp");

		dp.forward(req, res);

	}

}
